![]() Method and apparatus for automatically generating a test script for a graphical user interface.
专利摘要:
公开号:NL2010546A 申请号:NL2010546 申请日:2013-03-29 公开日:2013-10-01 发明作者:Yun Zhang;Jing Luo;Yuanji Wang 申请人:Ge Med Sys Global Tech Co Llc; IPC主号:
专利说明:
Method and Apparatus for Automatically Generating A Test Script for a Graphical User Interface Technical Field The present invention relates to the technical field of software test, in particular to the technical field of automatically generating a test script for a graphical user interface. Background of the Invention When using the prior art automation test tools to perform an automation test on a graphical user interface (GUI), testers need to manually program the corresponding test scripts according to the requirement of the test case. These automation test tools per se are only capable of automatically running these programmed test scripts. For example, the Windows-based automation test tool Winrunner and the Linux-based automation test tool Xrunner both belong to these types of automation test tools. Such automation test tools have the following problems: 1. It is difficult to program the test scripts manually. Different automation test tools have different programming styles and grammars, so testers have to be familiar with how to program qualified test scripts. Moreover, different test cases need to include different test scripts. 2. It is difficult to maintain the test scripts. Once the tested graphical user interface changes, all the test scripts will have to be manually modified. Summary of the Invention The technical problem to be solved by the present invention is to provide a method and apparatus for automatically generating a test script for a graphical user interface, which address the problem in the prior art that testers need to manually program test scripts and can hardly maintain the test scripts. To solve this problem, a first aspect of the present invention lies in providing a method for automatically generating a test script for a graphical user interface, which comprises the following steps: 1) defining information of each component in a tested graphical user interface: defining an attribute of each component and a mutually constraint relation between said component and other components; 2) writing a test case file: storing values to be written into each component in the tested graphical user interface and test check point information in said file; 3) generating a file of combined values of components: combining values of all components in the test case file to obtain several files of combined values, each file containing one possible combination; 4) adding an operation type to each component in each file of combined values: determining an operation type of each component value in the file of combined values according to the attribute of the component; 5) determining a sequence of operations in each of the files of combined values: rearranging the sequence of operations in the files of combined values according to the mutually constraint relation between the components; and 6) generating a test script: adding test check point information to the end of each file of combined values to obtain a test script file. To solve the above-mentioned problem, a second aspect of the present invention, in combination with the first aspect, lies in providing a method for automatically generating a test script for a graphical user interface, a range of value of an attribute of each component forms a set, which includes all possible operation types for said component. To solve the above-mentioned problem, a third aspect of the present invention, in combination with the first aspect, lies in providing a method for automatically generating a test script for a graphical user interface, a range of value of the mutually constraint relation of each component forms a set, which includes all input and output relations between said component and other components. To solve the above-mentioned problem, a fourth aspect of the present invention, in combination with the first aspect, lies in providing a method for automatically generating a test script for a graphical user interface, the information of each component further includes serial number, type and name of the component. To solve the above-mentioned problem, the present invention also provides an apparatus for automatically generating a test script for a graphical user interface, which comprises: a module for defining information of each component in a tested graphical user interface, which defines an attribute of each component and a mutually constraint relation between said component and other components; a module for writing a test case file, which stores values to be written into each component in the tested graphical user interface and test check point information in said file; a module for generating a file of combined values of components, which combines values of all components in the test case file to obtain several files of combined values, each file containing one possible combination; a module for adding an operation type to each component value in each file of combined values, which determines an operation type of each component value in the file of combined values according to the attribute of the component; a module for determining a sequence of operations in each of the files of combined values, which rearranges the sequence of operations in the files of combined values according to the mutually constraint relation between the components; and a module for generating a test script, which adds test check point information to the end of each file of combined values to obtain a test script file. Compared to the prior art, the method and apparatus for automatically generating a test script for a graphical user interface provided in the present invention achieve the following advantageous technical effects: 1. reducing the testers workload of manually programming test scripts; since test script files can be automatically generated according to the test case files, it is no longer necessary for testers to know the grammar for programming test scripts; 2. facilitating maintenance of test scripts; once the tested graphical user interface changes, new test script files can be regenerated automatically only by modifying the test case files. Brief Description of the Drawings Fig. 1 is a general flow chart of a method for automatically generating a test script for a graphical user interface provided by the present invention; Fig. 2 is a schematic block diagram of an apparatus for automatically generating a test script for a graphical user interface provided by the present invention; and Fig. 3 is a schematic drawing of a tested graphical user interface in a specific embodiment of the present invention. Detailed Description of the Invention The invention will be described further below with reference to the drawings and in conjunction with a specific embodiment. In this embodiment, a graphical user interface shown in Fig. 3 is tested. Step 1: defining information of each component in the tested graphical user interface in the following format: W={id, type, name, attribute, constraint) wherein, id is the serial number of the component; type is the type of the component, e.g. text box, button, pull-down box, etc.; name is the name of the component; attribute is the attribute of the component, whose range of value is a set describing all possible operation types for the component, such as insertion, deletion, clicking, selection; constraint is the constraint relation between the component and other components, for example, a relation describing that the component is an input of another component. It can be seen from Fig. 3 that said graphical user interface includes four components altogether, which are “Amount”, “Rate”, “Term” and “Calculate”. For each component, the information thereof is defined according to the above-mentioned format as follows: W1 = {idl, textbox, Amount, insert/delete, wl->w4 } W2 = {id2, textbox, Rate, insert/delete, w2->w4 } W3 = {id3, pull-down box, Term, select, w3->w4 } W4 = (id4, button, Calculate, click, w4->Window2 } wherein wl->w4, w2->w4, and w3->w4 mean that wl, w2 and w3 are inputs of w4 respectively; w4->Window2 means that w4 is outputted to another window, i.e. Window2, and contents displayed in Window2. Step 2: writing a test case file, which includes the following information: Wl: 21, O, -999 W2: 1.0, 6.48 W3: 1, 2, 3 W4: click, double click Check Window2 In the test case file, values for each component form a line, which include values to be written into each of the components in the tested graphical user interface during the test, and the last line of the test case file specifies check point information of said test case. Step 3: generating a file of combined values of the components. The component values in the test case file in step 2 are combined, and each possible combination is a file of combinations of component values. Examples of some of the combinations are as follows: Combined Value File 1: wl 21 w2 1.0 w3 1 w4 click Combined Value File 2 : wl 0 w2 1.0 w3 1 w4 click Combined Value File 3 : wl -999 w2 1.0 w3 1 w4 click Combined Value File 4 : wl -999 w2 6.48 w3 3 w4 double click step 4: determining an operation type of each component value in each file of combined values. An operation type of each component value in the file of combined values is determined according to the attribute of the component defined in step 1, and then added to the file of combined values. The file of combined values having the operation type added thereto is as follows: Combined Value File 1 insert wl 21 insert w2 1.0 select w3 1 click w4 click Combined Value File 2 : insert wl 0 insert w2 1.0 select w3 1 click w4 click Combined Value File 3 : insert wl -999 insert w2 1.0 select w3 1 click w4 click Combined Value File 4 : insert wl -999 insert w2 6.48 select w3 3 click w4 double click step 5: determining a sequence of the operations in each of the files of combined values. According to the constraint relation between components defined in step 1, the outputs of wl, w2 and w3 are necessary inputs for w4, so corresponding operations for wl, w2 and w3 should be performed before operation of w4. Therefore, this rule should guide the re-ordering of the operations of the file of combined values obtained in step 4. In this embodiment, before the re-ordering, the sequence of operations in the file of combined values happens to meet the requirement of this rule, so the sequence remains unchanged after the re-ordering. Step 6: generating test scripts. The test check point information in the test case file written in step 2 is added to the end of each of the files of combined values obtained in step 5 so as to obtain test script files as follows: Test Script File 1: insert wl 21 insert w2 1.0 select w3 1 click w4 click check Window2 Test Script File 2 : insert wl 0 insert w2 1.0 select w3 1 click w4 click check Window2 Test Script File 3 : insert wl -999 insert w2 1.0 select w3 1 click w4 click check Window2 Test Script File 4 : insert wl -999 insert w2 6.48 select w3 3 click w4 double click check Window2 It can be seen from the above descriptions that the information defined in step 1 is provided by the developer and designer of the graphical user interface, and only the second step needs to be written by testers of the graphical user interface, which does not involve large workload. As for the next few steps that involve larger workload, they can be performed automatically by a computer. Besides, when any modification is made to the tested graphical user interface and a test has to be made again, only the test case file needs to be modified, and then the next four steps can be performed automatically by a computer so as to quickly generate the needed new test script.
权利要求:
Claims (5) [1] A method for automatically generating a test instruction for a graphical user interface, comprising the following steps: 1. defining information of each component in a tested graphical user interface: defining an attribute of each component and a mutual conditional relationship between the component and other components; 2. writing a test file file: storing values to be written in each component in the tested graphical user interface and test-test information in said file; 3. generating a file of combined values of components: combining values of all components in the test file to obtain several files of combined values, each file being provided with one possible combination; 4. adding an operation type to each component in each file of combined values: determining an operation type of each component value in the file of combined values according to the attribute of the component; 5. determining a series of operations in each of the files of combined values: rearranging the order of operations in the files of combined values according to the mutually conditional relationship between the components; and 6. generating a test instruction: adding of the test test information at the end of each file of combined values to obtain a test instruction file. [2] The method of claim 1, wherein a value range of an attribute of each component forms a set that includes all possible processing types for said component. [3] The method of claim 1, wherein a value range of the mutual conditional relationship of each component forms a set that includes all input and output relationships between said component and other components. [4] The method of claim 1, wherein the information of each component further comprises serial number, type and name of the component. [5] An apparatus for automatically generating a test instruction for a graphical user interface, comprising: a module for defining information of each component in a tested graphical user interface, which has an attribute of each component and a mutual conditional relationship between said component and other components defines, a test file writing module, which stores values to be written in each component in the tested graphical user interface and test key information in said file, a module for generating a file of combined values of components, which combines values all components in the test file file to obtain several files of combined values, each file being provided with one possible combination, a module for adding an operation type to each component value in each file of combined values, which is a operation type of each component value determines in the file of combined values according to the attribute of the part, a module for determining a series of operations in each of the files of combined values, which rearranges the order of operations in the files of combined values according to the mutual conditional relationship between the components, and a test instruction generating module, which adds test key information at the end of each combined value file to obtain a test instruction file.
类似技术:
公开号 | 公开日 | 专利标题 NL2010546C2|2013-12-24|Method and apparatus for automatically generating a test script for a graphical user interface. US8225288B2|2012-07-17|Model-based testing using branches, decisions, and options US8196113B2|2012-06-05|Realtime creation of datasets in model based testing US9754059B2|2017-09-05|Graphical design verification environment generator US7617486B2|2009-11-10|Method and system to automate software testing using sniffer side and browser side recording and a toolbar interface US8347147B2|2013-01-01|Lifecycle management of automated testing US9779133B2|2017-10-03|Contextual debugging of SQL queries in database-accessing applications CN108351764B|2022-01-25|Data processing method and system US9104810B2|2015-08-11|Creating a test case US9424398B1|2016-08-23|Workflows for defining a sequence for an analytical instrument EP3129885A1|2017-02-15|Software test automation system and method US20090235229A1|2009-09-17|Graphical Modelization of User Interfaces for Data Intensive Applications US9471468B2|2016-10-18|System, method, and computer program to improve the productivity of unit testing US20140214396A1|2014-07-31|Specification properties creation for a visual model of a system De Ruvo et al.2014|An eclipse-based editor to support lotos newcomers US11138097B2|2021-10-05|Automated web testing framework for generating and maintaining test scripts Brezočnik et al.2014|SpinRCP: the Eclipse rich client platform integrated development environment for the Spin model checker US20070225953A1|2007-09-27|Management system and management method of CAD data CN109683883A|2019-04-26|A kind of Flow Chart Design method and device JP2021182252A|2021-11-25|Design information management device and design information management method US9870257B1|2018-01-16|Automation optimization in a command line interface JP5657183B2|2015-01-21|Method and apparatus for enabling a first computer program to execute application logic of a second computer program, for interfacing the first computer program and the second computer program And apparatus for generating computer program code for the same, a computer program, and a software interface for enabling a first computer program to execute application logic of a second computer program For providing information | Saini2011|Model-Based Testing Of Interactive Systems
同族专利:
公开号 | 公开日 NL2010546C2|2013-12-24| US20130262934A1|2013-10-03| CN103365643A|2013-10-23| CN103365643B|2017-07-21| US9141521B2|2015-09-22|
引用文献:
公开号 | 申请日 | 公开日 | 申请人 | 专利标题 EP0869433A2|1997-03-31|1998-10-07|Siemens Corporate Research, Inc.|A test development system and method for software with a graphical user interface| WO2000002123A1|1998-07-07|2000-01-13|Tenfold Corporation|Method for defining durable data for regression testing| US7165240B2|2002-06-20|2007-01-16|International Business Machines Corporation|Topological best match naming convention apparatus and method for use in testing graphical user interfaces| US7454660B1|2003-10-13|2008-11-18|Sap Ag|System and method for testing applications at the business layer| US7856619B2|2006-03-31|2010-12-21|Sap Ag|Method and system for automated testing of a graphic-based programming tool| JP4148527B2|2006-06-05|2008-09-10|インターナショナル・ビジネス・マシーンズ・コーポレーション|Functional test script generator| WO2009108203A1|2008-02-29|2009-09-03|Hewlett-Packard Development Company, L.P.|Identification of elements of currently-executing component script| CN101526916B|2008-03-03|2012-05-30|阿里巴巴集团控股有限公司|Method and system for using page-based object flow verification in regression test| CN101339534B|2008-06-17|2010-10-13|金蝶软件(中国)有限公司|Software test apparatus and test method| US20100281467A1|2009-04-29|2010-11-04|Hexaware Technologies, Inc.|Method and apparatus for automatic software testing| US8918760B2|2012-12-07|2014-12-23|Sugarcrm Inc.|Test script generation for application image validation|WO2015157470A1|2014-04-08|2015-10-15|Turnkey Solutions Corp.|Software test automation system and method| CN103984626B|2014-05-13|2017-07-28|华为技术有限公司|A kind of method and device for generating test case script| CN104008050B|2014-05-16|2016-08-31|北京交通大学|A kind of system and method automatically generating interface pattern experimental test sequence| CN104572961A|2014-12-30|2015-04-29|北京奇虎科技有限公司|Acquiring method and device of transaction data| US10229038B2|2016-03-15|2019-03-12|International Business Machines Corporation|Generating reusable testing procedures| CN107239392B|2016-03-29|2021-02-12|腾讯科技(深圳)有限公司|Test method, test device, test terminal and storage medium| CN106021102B|2016-05-16|2019-05-28|北京奇虎科技有限公司|The generation method and device of automatic test file| CN106526506A|2016-11-03|2017-03-22|武汉通畅汽车电子照明有限公司|LED automobile headlamp test case automatic generation method| JP6684233B2|2017-01-12|2020-04-22|株式会社日立製作所|Test input information retrieval device and method| CN107391378A|2017-07-27|2017-11-24|郑州云海信息技术有限公司|The generation method and device of a kind of test script| CN109857668A|2019-02-03|2019-06-07|苏州市龙测智能科技有限公司|UI automated function test method, test device, test equipment and storage medium| US11074162B2|2019-04-15|2021-07-27|Cognizant Technology Solutions India Pvt. Ltd.|System and a method for automated script generation for application testing| CN111352844B|2020-03-04|2021-08-17|腾讯科技(深圳)有限公司|Test method and related device| CN113742250A|2021-11-05|2021-12-03|广州易方信息科技股份有限公司|Automatic interface testing method and device|
法律状态:
2016-11-16| MM| Lapsed because of non-payment of the annual fee|Effective date: 20160401 |
优先权:
[返回顶部]
申请号 | 申请日 | 专利标题 CN201210102231.4A|CN103365643B|2012-03-30|2012-03-30|A kind of method and device for the test script for automatically generating graphic user interface| CN201210102231|2012-03-30| 相关专利
Sulfonates, polymers, resist compositions and patterning process
Washing machine
Washing machine
Device for fixture finishing and tension adjusting of membrane
Structure for Equipping Band in a Plane Cathode Ray Tube
Process for preparation of 7 alpha-carboxyl 9, 11-epoxy steroids and intermediates useful therein an
国家/地区
|